#include "Utils.h"
#include "ListNode.h"
#include "TreeNode.h"
#include <iostream>
#include <vector>
#include <string>

using namespace std;

class Issue204 {
public:
	int countPrimes(int n) {
		bool* indList=new bool[n];
		for (int i=0;i<n;++i)
			indList[i]=true;

		for(int i=2;i*i<n;++i){
			for (int j=i*i;j<n;j+=i)
				indList[j]=false;
		}

		int count=0;
		for (int i=2;i<n;++i)
			if (indList[i]==true)
			count++;

		return count;
	}
};

int main204(){

	Issue204 sol;
	int n;
	while(true){
		cin>>n;
		cout<<sol.countPrimes(n)<<endl;
	}
	return 0;
}